const path = require("path");
const Koa = require("koa");
const static = require("koa-static");
const views = require("koa-views");

const app = new Koa();
// 静态资源
app.use(static(path.join(__dirname, "static")));
// 模板引擎
app.use(views(path.join(__dirname, "views"), { extension: "ejs" }));

app.use(async (ctx) => {
    // 渲染模板
    await ctx.render("index", {
        title: "koa2首页标题",
        content: "koa2 模板引擎",
    });
});

app.listen(3000);
